export function getCurrentRaceScore(left, right, leftTotal, rightTotal, before, after) {
    console.log(left, right, leftTotal, rightTotal, before, after)
    let score = 0;
    if (leftTotal == "--" && rightTotal == "--") {
        return score;
    }
    if ((left > right && leftTotal > rightTotal) || (left < right && leftTotal < rightTotal) || (left === right && leftTotal === rightTotal)) {
        //胜负关系猜对得三分
        score += left !== null ? 3 : 0
    }
    if (left === leftTotal && right === rightTotal) {
        //比分一样得三分
        score += 3
    }
    if (before == 1) {
        score += 3
    }
    if (after == 1) {
        score += 3
    }
    return score;
}

export function compareObj(prop) {
    return function (obj1, obj2) {
        var val1 = obj1[prop];
        var val2 = obj2[prop];
        if (val1 < val2) {
            return 1;
        } else if (val1 > val2) {
            return -1;
        } else {
            return 0;
        }
    }
}
